// page/xiangqin/xiangqing.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    baseURL:wx.baseURL,
    skus:[],
    dianzan:[
      {
      id:1,
      state:'false',
      change:'false',
      img:'../../image/zan.png',
      img1:'../../image/sc.png',
    }],
    text:0,
    xqsp:[]
  },

  dianzan:function(){
    let that=this.data
    var digit=parseInt(that.text)
    let change=that.change
    console.log(change)
    console.log(digit)
    if(change == 'true'){
      that.text=(digit-1)
      that.change='false'
      that.state=false 
    }else{
      that.text=(digit+1)
      that.change='true'
      that.state=true
    }
    this.setData({
      text:that.text,
      change:that.change,
      state:that.state
    })
  },


  tiao:function(){
    wx.navigateTo({
      url: '../../page/fenleizhong/fenleizhong',
    })
  },




  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.$https.get('/product',{productId:options.productId}).then((res)=>{
      console.log(res)
      res.imgs = res.imgs.split(',')
      this.setData({
        xqsp:res,
        skus:res.skus
      })
      wx.setNavigationBarTitle({
        title: res.name,
      })
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    return{
      title:this.data.xqsp.name,

      imageUrl:''
  }
  }
})